<!doctype html>
<html lang="zh-CN" th:replace="admin-layout :: layout(~{::title}, ~{}, ~{::script}, ~{::body}, 'material-list')"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <title>图片列表</title>
    <script>
        var $remove = $("#removeBtn");
        var $update = $("#updateBtn");
        var $search = $("#searchBtn");

        $remove.click(function () {
            confirmAlert(function () {
                ajaxJson("/admin/material/ajax/delete", {"ids": ids.toString()}, function (res) {
                    if (res.status) {
                        $remove.prop('disabled', true);
                        $update.prop('disabled', true);
                        loadData();
                    }
                })
            })
        })

        $update.click(function () {
            location.href = "/admin/material/save?id=" + ids[0]
        })

        $search.click(function () {
            loadData()
        })

        $(function(){
            loadData();
        })

        //加载数据
        function loadData() {
            $.post("/admin/material/child/list", {name: $("#name").val()},
                function (data) {
                    $("#html").html(data);
                });
        }
    </script>
</head>
<body>
<ol class="breadcrumb">
    <li class="active">图片列表</li>
</ol>
<div class="fyl-mb10">
    <form id="toolbar">
        <input type="hidden" name="page" id="page">
        <div class="row">
            <div class="col-sm-4 col-md-4 col-lg-2 fyl-mb10">
                <input type="text" class="form-control fyl-clear"
                       placeholder="图片名称" id="name">
            </div>
            <div class="col-sm-4 col-md-4 col-lg-2 fyl-mb10">
                <button type="button" class="btn btn-primary" id="searchBtn">查询</button>
                <button type="button" class="btn btn-warning" id="clearSearchBtn">清空</button>
            </div>
        </div>
    </form>
</div>
<div class="fyl-mb20">
    <a th:href="@{/admin/material/save}" class="btn btn-primary">添加</a>
    <button type="button" class="btn btn-primary" id="updateBtn" disabled>修改</button>
    <button type="button" class="btn btn-danger" id="removeBtn" disabled>删除</button>
</div>
<div id="html">

</div>
</body>
</html>